public  class Cbl_SumOrdertoAccount {
	
	public static void sumOrder(List<Order__c> list_order){
		//AccountId
		Set<Id> Set_AccId=new Set<Id>();
		for(Order__c ord:list_order)
		{
			Set_AccId.add(ord.Account__c);
		}
		List<Account> list_Acc=new  List<Account>();
	
		string ym=string.valueof(Date.today().year())+'-'+string.valueof(Date.today().month());
		AggregateResult[] sumManday = [select Account__c,count(id) id  from Order__c 
        where Account__c IN: Set_AccId and CreatedYM__c=:ym
        group by Account__c];
                                   
	    for(AggregateResult ar : sumManday)
	    {
	    	if(ar.get('Account__c')!=null)
	    	{
	    		Account acc = new Account(
	                               id=id.valueOf(String.valueof(ar.get('Account__c')))
	                               ,Order_Number__c = Double.valueOf(ar.get('id')));
	        	list_Acc.add(acc);
	    	}
	        
	    }
	    update list_Acc;
	}

}